﻿using System;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using Moonlite.Composition;

namespace Moonlite.UI.Shell.Controls {
    public partial class Credits : Form {
        private void OnVestrasLinkClicked(object sender, MouseEventArgs e) {
            Process.Start("http://www.vestras.net");
        }

        private void OnStormLinkMouseUp(object sender, MouseEventArgs e) {
            Process.Start("http://www.stormide.codeplex.com");
        }

        private void OnDXperienceLinkMouseUp(object sender, MouseEventArgs e) {
            Process.Start("http://www.devexpress.com");
        }

        public void UpdateExtensions() {
            listBoxInstalledExtensions.Items.Clear();
            listBoxInstalledExtensions.Items.AddRange(ExtensionManagerForm.Extensions.ToArray());
        }

        public new void Show() {
            UpdateExtensions();
            base.Show();
        }

        public new DialogResult ShowDialog() {
            UpdateExtensions();
            return base.ShowDialog();
        }

        public new DialogResult ShowDialog(IWin32Window owner) {
            UpdateExtensions();
            return base.ShowDialog(owner);
        }

        public Credits() {
            InitializeComponent();
            Assembly assembly = typeof(Credits).Assembly;
            labelVersion.Text = assembly.GetName().Version.ToString();
            labelVestras.Location = new Point(labelVersion.Location.X + labelVersion.Size.Width + 5, labelVestras.Location.Y);
        }
    }
}